//@author A0092201X
#include "TextManipulatorStub.h"
#include <fstream>

TextManipulatorStub::TextManipulatorStub(std::string fileName) : Manipulator(fileName) {
	std::vector<Task> taskVector;
	
	std::ostringstream oss0;
	std::ostringstream oss1;
	std::ostringstream oss2;
	std::ostringstream oss3;
	std::ostringstream oss4;
	std::ostringstream oss5;
	std::ostringstream oss6;
	std::ostringstream oss7;
	std::ostringstream oss8;
	std::ostringstream oss9;
	std::ostringstream oss10;
	std::ostringstream oss11;
	std::ostringstream oss12;
	std::ostringstream oss13;
	std::ostringstream oss14;
	std::ostringstream oss15;
	std::ostringstream oss16;
	std::ostringstream oss17;

	//Floating tasks:
	oss0 << "[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist";
	Task task0(0, oss0.str());
	taskVector.push_back(task0);
	oss1 << "[F]\tLearn guitar\t-\t-\t-";
	Task task1(1, oss1.str());
	taskVector.push_back(task1);
	oss2 << "[F]\tBring parents to Madives\t-\t-\t-";
	Task task2(2, oss2.str());
	taskVector.push_back(task2);
	
	//Rest of tasks:
	//week from 10/02/14 to 16/02/14
	oss3 << "[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc";
	Task task3(3, oss3.str());
	taskVector.push_back(task3);
	oss4 << "[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc";
	Task task4(4, oss4.str());
	taskVector.push_back(task4);
	oss5 << "[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc";
	Task task5(5, oss5.str());
	taskVector.push_back(task5);
	oss6 << "[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc";
	Task task6(6, oss6.str());
	taskVector.push_back(task6);
	oss7 << "[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-";
	Task task7(7, oss7.str());
	taskVector.push_back(task7);
	oss8 << "[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House";
	Task task8(8, oss8.str());
	taskVector.push_back(task8);
	oss9 << "[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous";
	Task task9(9, oss9.str());
	taskVector.push_back(task9);
	oss10 << "[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)";
	Task task10(10, oss10.str());
	taskVector.push_back(task10);
	oss11 << "[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place";
	Task task11(11, oss11.str());
	taskVector.push_back(task11);
	oss12 << "[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel";
	Task task12(12, oss12.str());
	taskVector.push_back(task12);
	oss13 << "[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-";
	Task task13(13, oss13.str());
	taskVector.push_back(task13);
	oss14 << "[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-";
	Task task14(14, oss14.str());
	taskVector.push_back(task14);
	oss15 << "[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries";
	Task task15(15, oss15.str());
	taskVector.push_back(task15);
	oss16 << "[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk";
	Task task16(16, oss16.str());
	taskVector.push_back(task16);
	oss17 << "[P]\tTime to sleep\t16/02/14 0600\t-\t-";
	Task task17(17, oss17.str());
	taskVector.push_back(task17);

	_taskVector = taskVector;

	std::ofstream outFile;

	outFile.open("stubOutput.txt", std::ios::trunc);

	for(unsigned int i = 0; i < taskVector.size(); i++) { 
		outFile << taskVector[i].prepareLine() << std::endl;
	}

	outFile.close(); 
}


TextManipulatorStub::~TextManipulatorStub(void) {
}

void TextManipulatorStub::write(std::vector<Task> taskVector) {
	_taskVector = taskVector;
}
	
void TextManipulatorStub::append(Task task) {
	_taskVector.push_back(task);
}

std::vector<Task> TextManipulatorStub::read(void) {
	return _taskVector;
}

void TextManipulatorStub::sort() {
}